package com.solution.admin.customer.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.solution.admin.customer.dao.DeliveryModeDao;
import com.solution.admin.customer.entity.DeliveryModeEntity;
import com.solution.common.dao.impl.BaseDaoImpl;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;

/**
 * 单位配件方式DAO实现
 * @author solin
 * @date 2017-10-29 21:56:05
 */
@Repository
public class DeliveryModeDaoImpl extends BaseDaoImpl<DeliveryModeEntity> implements DeliveryModeDao {
	@Autowired
	private SqlSessionTemplate sessionTemplate;
	
	/**
	 * 保存单位配件方式信息
	 * @param deliveryModeEntity
	 * @return
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	@Override
	public long saveDeliveryMode(DeliveryModeEntity deliveryModeEntity) {
		return super.insert(deliveryModeEntity);
	}
	
	/**
	 * 批量保存单位配件方式
	 * @param deliveryModeEntity
	 * @return
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	@Override
	public long batchSaveDeliveryMode(List<DeliveryModeEntity> deliveryModeList){
		return super.insert(deliveryModeList);
	}

	/**
	 * 分页查询单位配件方式信息
	 * @param pageParam 分页对象
	 * @param deliveryMode 分页参数
	 * @return PageBean 分页参数及数据
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	public PageBean listDeliveryModePage(PageParam pageParam, Map<String, Object> param) {
		return super.listPage(pageParam, param);
	}

	/**
	 * 更新单位配件方式
	 * @param deliveryModeEntity
	 * @return
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	@Override
	public int updateDeliveryMode(DeliveryModeEntity deliveryModeEntity) {
		return super.update(deliveryModeEntity);
	}

	/**
	 * 删除单位配件方式
	 * @param deliveryModeId
	 * @return
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	@Override
	public int deleteDeliveryModeById( Long id) {
		return super.deleteById(id);
	}
	
	/**
	 * 通过公司ID删除单位配件方式角色
	 * @param id
	 * @return
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	@Override
	public int deleteDeliveryModeByCompanyId(Long companyId) {
		return sessionTemplate.delete("deleteByCompanyId", companyId);
	}
	
	/**
	 * 根据条件查询单位配件方式
	 * @param param
	 * @return
	 * @author solin
	 * @date 2017-10-29 21:56:05
	 */
	@Override
	public List<DeliveryModeEntity> listDeliveryMode( Map<String, Object> param) {
		return super.listBy(param);
	}
}
